package com.jianying.mapper;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.jianying.base.BaseMapper;
import com.jianying.dataSource.TargetDataSource;
import com.jianying.domain.Order;

@Repository("orderMapper")
public class OrderMapper extends BaseMapper {
	
	private final static String NAME_SPACE = "com.jianying.mapper.OrderMapper.";
	
	@TargetDataSource(name="ds1")
	public void insert(Order order) {
		getSqlSessionTemplate().insert(NAME_SPACE + "insert", order);
	}
	
	public List<Order> all(){
		return getSqlSessionTemplate().selectList(NAME_SPACE + "all");
	}
	
	public Order find(Integer id){
		return getSqlSessionTemplate().selectOne(NAME_SPACE + "find", id);
	}
	
	@TargetDataSource(name="ds1")
	public Order byUuid(String uuid){
		return getSqlSessionTemplate().selectOne(NAME_SPACE + "byUuid", uuid);
	}
	
	public Order findByUuid(String uuid){
		return getSqlSessionTemplate().selectOne(NAME_SPACE + "findByUuid", uuid);
	}
}
